package com.lq.JDBC;

import com.lq.JDBC.Dao.TeacherDao;
import com.lq.JDBC.Dao.UserDao;
import com.lq.JDBC.Dao.impl.TeacherDaoImpl;
import com.lq.JDBC.Dao.impl.UserDaoImpl;
import com.lq.JDBC.entity.Teacher;
import com.lq.JDBC.entity.User;
import org.junit.Test;

import java.sql.Date;

public class BaseDaoTest {
    @Test
    public void test1(){
        TeacherDao teacherDao = new TeacherDaoImpl();
        System.out.println(teacherDao.queryAll(Teacher.class));
    }

    @Test
    public void test2(){
        TeacherDao teacherDao = new TeacherDaoImpl();
        System.out.println(teacherDao.queryByName("zl", Teacher.class));
    }

    @Test
    public void test3(){
        TeacherDao teacherDao = new TeacherDaoImpl();
        teacherDao.insert(new Teacher(null,"liuqiang"));
        System.out.println(teacherDao.queryAll(Teacher.class));
    }

    @Test
    public void test4(){
        TeacherDao teacherDao = new TeacherDaoImpl();
        teacherDao.delete("username","liuqiang",Teacher.class);
        System.out.println(teacherDao.queryAll(Teacher.class));
    }

    @Test
    public void test5(){
        TeacherDao teacherDao = new TeacherDaoImpl();
        teacherDao.update(new Teacher(5,"adfaadffadfdf"));
        System.out.println(teacherDao.queryAll(Teacher.class));
    }






    @Test
    public void test6(){
        UserDao userDao = new UserDaoImpl();
        System.out.println(userDao.queryAll(Teacher.class));
    }

    @Test
    public void test7(){
        UserDao userDao = new UserDaoImpl();
        System.out.println(userDao.queryByName("jdfaerry", User.class));
    }

    @Test
    public void test8(){
        UserDao userDao = new UserDaoImpl();
        userDao.insert(new User(null,"test","test",new Date(new java.util.Date().getTime())));
        System.out.println(userDao.queryAll(Teacher.class));
    }

    @Test
    public void test9(){
        UserDao userDao = new UserDaoImpl();
        userDao.delete("username","test",User.class);
        System.out.println(userDao.queryAll(User.class));
    }

    @Test
    public void test10(){
        UserDao userDao = new UserDaoImpl();
        userDao.update(new User(5,"gggadfaafgggg","ggasdfaggggg",new Date(new java.util.Date().getTime())));
        System.out.println(userDao.queryAll(Teacher.class));
    }


}
